<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers"
	xmlns:core="http://typo3.org/ns/TYPO3/CMS/Core/ViewHelpers"
	xmlns:fl="http://typo3.org/ns/TYPO3/CMS/Filelist/ViewHelpers">
<f:layout name="Default"/>

<f:section name="headline">
	<h1><f:translate id="search">Search</f:translate>: "{searchWord}"</h1>
</f:section>

<f:section name="content">

	<f:render partial="SearchForm" arguments="{searchWord:searchWord}" />

	<f:if condition="{files->f:count()} > 0">
		<div class="table-fit">
			<table class="table table-striped table-hover" id="typo3-filelist">
				<thead>
				<tr data-uid="0" data-l10nparent="0">
					<th nowrap="nowrap" class="col-icon"></th>
					<th nowrap="nowrap" class="col-path">{f:translate( htmlEscape:'true', key:'LLL:EXT:lang/locallang_mod_file_list.xlf:c_filepath' )}</th>
					<th nowrap="nowrap" class="col-title">{f:translate( htmlEscape:'true', key:'LLL:EXT:lang/locallang_mod_file_list.xlf:c_file' )}</th>
					<th nowrap="nowrap" class="col-control"></th>
					<th nowrap="nowrap">{f:translate( htmlEscape:'true', key:'LLL:EXT:lang/locallang_mod_file_list.xlf:c_fileext' )}</th>
					<th nowrap="nowrap">{f:translate( htmlEscape:'true', key:'LLL:EXT:lang/locallang_mod_file_list.xlf:c_tstamp' )}</th>
					<th nowrap="nowrap">{f:translate( htmlEscape:'true', key:'LLL:EXT:lang/locallang_mod_file_list.xlf:c_size' )}</th>
					<th nowrap="nowrap">{f:translate( htmlEscape:'true', key:'LLL:EXT:lang/locallang_mod_file_list.xlf:c_rw' )}</th>
					<th nowrap="nowrap">{f:translate( htmlEscape:'true', key:'LLL:EXT:lang/locallang_mod_file_list.xlf:c__REF_' )}</th>
				</tr>
				</thead>
				<tbody>
				<f:for each="{files}" as="file">
					<tr data-uid="0" data-l10nparent="0">
						<td nowrap="nowrap" class="col-icon">
							<fl:link.clickMenuOnIcon table="{file.combinedIdentifier}">
								{file.icon->f:format.raw()}
							</fl:link.clickMenuOnIcon>
						</td>
						<td nowrap="nowrap" class="col-path">
							{file.path}
						</td>
						<td nowrap="nowrap" class="col-title">
							<f:if condition="{file.isMetadataEditable}">
								<f:then>
									<a href="#" class="filelist-file-title"
										title="{f:translate( htmlEscape:'true', key:'LLL:EXT:lang/locallang_core.xlf:cm.editMetadata' )}"
										data-url="{fl:uri.editSysFileMetadataRecord( uid:file.metadataUid, returnUrl:'{f:uri.action( action:\'search\', arguments:{ searchWord:\'{searchWord->f:format.htmlentities()}\' } )}' )}"
									>
										{file.name->f:format.crop( maxCharacters:30 )}
									</a>
								</f:then>
								<f:else>
									{file.name->f:format.crop( maxCharacters:30 )}
								</f:else>
							</f:if>
							<f:if condition="{file.isImage}">
								<br>
								<f:image image="{file.resource}" maxWidth="64" maxHeight="43" />
							</f:if>
						</td>
						<td nowrap="nowrap" class="col-control">
							<div class="btn-group">
								<f:if condition="{file.isEditable}">
									<f:then>
										<a href="#" class="btn btn-default filelist-file-edit"
											title="{f:translate( htmlEscape:'true', key:'LLL:EXT:lang/locallang_core.xlf:cm.editcontent' )}"
											data-url="{fl:uri.editFileContent( file:file.resource, returnUrl:'{f:uri.action( action:\'search\', arguments:{ searchWord:\'{searchWord->f:format.htmlentities()}\' } )}' )}"
										>
											<core:icon identifier="actions-page-open" />
										</a>
									</f:then>
									<f:else>
										<span class="btn btn-default disabled"><core:icon identifier="empty-empty" /></span>
									</f:else>
								</f:if>

								<f:if condition="{file.publicUrl}">
									<f:then>
										<a href="#" class="btn btn-default filelist-file-view"
											title="{f:translate( htmlEscape:'true', key:'LLL:EXT:lang/locallang_core.xlf:cm.view' )}"
											data-url="{file.publicUrl}"
										>
											<core:icon identifier="actions-document-view" />
										</a>
									</f:then>
									<f:else>
										<span class="btn btn-default disabled"><core:icon identifier="empty-empty" /></span>
									</f:else>
								</f:if>

								<f:if condition="{file.isReplaceable}">
									<f:then>
										<a href="#" class="btn btn-default filelist-file-replace"
											title="{f:translate( htmlEscape:'true', key:'LLL:EXT:lang/locallang_core.xlf:cm.replace' )}"
											data-url="{fl:uri.replaceFile( file:file.resource, returnUrl:'{f:uri.action( action:\'search\', arguments:{ searchWord:\'{searchWord->f:format.htmlentities()}\' } )}' )}"
										>
											<core:icon identifier="actions-edit-replace" />
										</a>
									</f:then>
									<f:else>
										<span class="btn btn-default disabled"><core:icon identifier="empty-empty" /></span>
									</f:else>
								</f:if>

								<f:if condition="{file.isRenamable}">
									<f:then>
										<a href="#" class="btn btn-default filelist-file-rename"
											title="{f:translate( htmlEscape:'true', key:'LLL:EXT:lang/locallang_core.xlf:cm.rename' )}"
											data-url="{fl:uri.renameFile( file:file.resource, returnUrl:'{f:uri.action( action:\'search\', arguments:{ searchWord:\'{searchWord->f:format.htmlentities()}\' } )}' )}"
										>
											<core:icon identifier="actions-edit-rename" />
										</a>
									</f:then>
									<f:else>
										<span class="btn btn-default disabled"><core:icon identifier="empty-empty" /></span>
									</f:else>
								</f:if>

								<f:if condition="{file.isReadable}">
									<f:then>
										<a href="#" class="btn btn-default filelist-file-info"
											title="{f:translate( htmlEscape:'true', key:'LLL:EXT:lang/locallang_core.xlf:cm.info' )}"
											data-identifier="{file.combinedIdentifier}"
										>
											<core:icon identifier="actions-document-info" />
										</a>
									</f:then>
									<f:else>
										<span class="btn btn-default disabled"><core:icon identifier="empty-empty" /></span>
									</f:else>
								</f:if>
								<f:if condition="{file.isDeletable}">
									<f:then>
										<a href="#" class="btn btn-default t3js-filelist-delete"
											title="{f:translate( htmlEscape:'true', key:'LLL:EXT:lang/locallang_core.xlf:cm.delete' )}"
											data-identifier="{file.identifier}"
											data-veri-code="{veriCode}"
											data-title="{f:translate( htmlEscape:'true', key:'LLL:EXT:lang/locallang_core.xlf:cm.delete' )}"
											data-content="{f:translate( htmlEscape:'true', key:'LLL:EXT:lang/locallang_core.xlf:mess.delete', arguments: {0:file.name} )}"
											data-check="{f:if(condition:settings.jsConfirmationDelete, then:'1', else:'0')}"
											data-delete-url="{deleteUrl}"
											data-redirect-url="{f:uri.action( action:'search', arguments:{ searchWord:'{searchWord->f:format.htmlentities()}' } )}"
										>
											<core:icon identifier="actions-edit-delete" />
										</a>
									</f:then>
									<f:else>
										<span class="btn btn-default disabled"><core:icon identifier="empty-empty" /></span>
									</f:else>
								</f:if>
							</div>
						</td>
						<td nowrap="nowrap">{file.extension}</td>
						<td nowrap="nowrap">{file.lastModified}</td>
						<td nowrap="nowrap">{file.size}</td>
						<td nowrap="nowrap">
							<f:if condition="{file.isReadable}"><strong class="text-danger">{f:translate( htmlEscape:'true', key:'LLL:EXT:lang/locallang_mod_file_list.xlf:read' )}</strong></f:if><f:if condition="{file.isWritable}"><strong class="text-danger">{f:translate( htmlEscape:'true', key:'LLL:EXT:lang/locallang_mod_file_list.xlf:write' )}</strong></f:if>
						</td>
						<td nowrap="nowrap">
							<f:if condition="{file.referenceCount} > 0">
								<f:then>
									<a href="#" class="filelist-file-references" data-identifier="{file.combinedIdentifier}" title="{f:translate( htmlEscape:'true', key:'LLL:EXT:backend/Resources/Private/Language/locallang.xlf:show_references' )} ({file.referenceCount})">{file.referenceCount}</a>
								</f:then>
								<f:else>
									-
								</f:else>
							</f:if>
						</td>
					</tr>
				</f:for>
				</tbody>
			</table>
		</div>
	</f:if>
</f:section>
</html>
